package com.wex.cookbook.dto.from.userInfo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Null;
import javax.validation.constraints.Pattern;

import static com.wex.cookbook.utils.BaseRegexPatterns.*;

/**
 * <p> 用户注册参数 </p>
 * @author : wex
 * @createTime : 2023/10/16 14:58
 */
@Data
@ApiModel(value = "用户注册参数")
public class RegisterDto {

    @ApiModelProperty(value = "用户名")
    @NotBlank(message = "用户名不能为空")
    @Length(min = 1, max = 20, message = "用户名长度必须在1-20位之间")
    @Pattern(regexp = CHINESE_NAME_REGEX, message = "用户名只能是中文和英文")
    private String username;

    @NotBlank(message = "密码不能为空")
    @Pattern(regexp = PASSWORD_REGEX, message = "密码必须是6-20位的数字和字母组合")
    @ApiModelProperty(value = "密码")
    private String password;

    @ApiModelProperty(value = "电话号码")
    private String phone;

    @ApiModelProperty(value = "电子邮件")
    private String email;
}
